<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.min.js"></script>
    <script src="assets/js/zepto.min.js"></script>
    <script src="assets/js/amazeui.min.js"></script>
    <script src="assets/js/app.js"></script>
</head>
<body>
<h1>测试页面</h1>
<form id="tab1">
    private Integer id;
    private String name;
    private BigDecimal rPrice;
    private BigDecimal bPrice;
    private Integer isPutaway;
    private Integer unitId;
    private Integer sortId;
    private Integer brandId;
    private Integer supplierId;
    private Integer minQuantity;
    private Integer maxQuantity;
    private Integer minStock;
    private Integer maxStock;
    private String barcode;
    private String keyword;
    private String sellpoints;
    private String description;
    <input type="text" name="name" placeholder="name">
    <input type="text" name="rPrice" placeholder="rPrice">
    <input type="text" name="bPrice" placeholder="bPrice">
    <input type="text" name="isPutaway" placeholder="isPutaway">
    <input type="text" name="unitId" placeholder="unitId">
    <input type="text" name="sortId" placeholder="sortId">
    <input type="text" name="brandId" placeholder="brandId">
    <input type="text" name="supplierId" placeholder="supplierId">
    <input type="text" name="minQuantity" placeholder="minQuantity">
    <input type="text" name="maxQuantity" placeholder="maxQuantity">
    <input type="text" name="minStock" placeholder="minStock">
    <input type="text" name="maxStock" placeholder="maxStock">
    <input type="text" name="barcode" placeholder="barcode">
    <input type="text" name="keyword" placeholder="keyword">
    <input type="text" name="sellpoints" placeholder="sellpoints">
    <input type="text" name="description" placeholder="description">
    <input type="file" name="file" multiple @change="tupian($event)">
    <a href="#" @click="chakan">查看</a>
    <a href="#" @click="tijiao">提交</a>
    <ul>
        <li v-for="f in files">
            <img :src="geturl(f)" alt="">
        </li>
    </ul>
    <ul>
        <li v-for=""></li>
    </ul>
</form>
<div id="vm">
    <input type="checkbox" value="1" name="x" v-model="box">1 <br>
    <input type="checkbox" value="2" name="x" v-model="box">2 <br>
    <input type="checkbox" value="3" name="x" v-model="box">3 <br>
    <input type="checkbox" value="4" name="x" v-model="box">4 <br>
    <input type="checkbox" value="5" name="x" v-model="box">5 <br>
    <input type="button" value="查看" @click="chakan">
    <input type="button" value="测试" @click="ceshi">
    <input type="button" value="发送" @click="fasong">
</div>

</body>
<script>
    var vm=new Vue({
        el:"#vm",
        data:{
            box:[],
        },
        methods: {
            fasong(){
                axios.post('/wares/addStock_order',{
                    stock_order:{
                        code:'13213fadsfs',
                        type:1,
                        status:1,
                        houseId:1
                    },
                    list:[
                        {
                            stockCode:'sdaf21',
                            waresId:'1',
                            quantity:12,
                            unit:'sdf'
                        },
                        {
                            stockCode:'sdaf21',
                            waresId:'1',
                            quantity:12,
                            unit:'sdf'
                        },
                        {
                            stockCode:'sdaf21',
                            waresId:'1',
                            quantity:12,
                            unit:'sdf'
                        }
                    ]
                }).then(res=>{
                    console.log(res.data)
                })
            },
            chakan(){
                console.log(this.box)
            },
            ceshi(){
                axios.post("/wares/test2",{
                    list:this.box
                }).then(res=>{
                    console.log(res.data)
                })
            }
        }
    })
</script>
<script>
    // function geturl(file) {
    //     return window.URL.createObjectURL(file)
    // }
    var table1=new Vue({
        el:'#tab1',
        data:{
            files:[],
            status:["","待提交","待审核","待发货"]
        },
        methods:{
            geturl(file) {
                return window.URL.createObjectURL(file)
            },
            tijiao(){
                var data=new FormData($("#tab1")[0]);
                data.append("file",table1.files)
                axios.post('wares/addWares',data,{
                    'Content-Type':'multipart/form-data'
                }).then(response =>
                {
                    var data=response.data;
                    console.log(data)
                })
            },
            chakan(e){
                // var data=new FormData($("#tab1")[0])
                // console.log(data.get('id'))
                // console.log(data.get('name'))
                // console.log(data.get('file'))
                // console.log(table1.files)
                // for (var i in status){
                //     console.log(i+":"+status[i])
                // }
                var obj=2
                console.log(this.status[obj])
            },
            tupian(e){
                var files=$(e.target)[0].files
                for (var i=0;i<files.length;i++){
                    this.files.push(files[i])
                }
            }

        },
        mounted(){

        }
    })


</script>
</html>